package com.yidu.boss.sys.service.impl;

import com.yidu.boss.sys.dao.SeatMapper;
import com.yidu.boss.sys.domain.BrokerExample;
import com.yidu.boss.sys.domain.Seat;
import com.yidu.boss.sys.domain.SeatExample;
import com.yidu.boss.sys.service.SeatService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: fund_management_system
 * @ClassName SeatSeriveceImpl
 * @author: Zc
 * @create: 2019-11-28 10:58
 **/
@Service
public class SeatSeriveceImpl implements SeatService {

    @Resource
    SeatMapper seatMapper;


    @Override
    public List<Seat> selectAll() {
        return seatMapper.selectByExample(null);
    }

    @Override
    public int update(Seat seat) {
        return seatMapper.updateByPrimaryKeySelective(seat);
    }

    @Override
    public int add(Seat seat) {
        return seatMapper.insertSelective(seat);
    }

    @Override
    public int delete(String id) {
        return seatMapper.deleteByPrimaryKey(id);
    }

    /**
     * 关键字查询
     *
     * @param Keyword
     * @return
     */
    @Override
    public List<Seat> selectLike(String Keyword) {
        SeatExample seatExample = new SeatExample();
        seatExample.or().andBrokeridLike("%"+Keyword+"%");
        seatExample.or().andBrokernameLike("%"+Keyword+"%");
        seatExample.or().andDealSiteLike("%"+Keyword+"%");
        seatExample.or().andSeatidLike("%"+Keyword+"%");
        seatExample.or().andSeatnameLike("%"+Keyword+"%");
        seatExample.or().andDealtypeLike("%"+Keyword+"%");
        return seatMapper.selectByExample(seatExample);
    }
}
